{include file="public/header" /}
<script charset="utf-8" src="/public/static/admin/myeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/public/static/admin/myeditor/lang/zh_CN.js"></script>
<!-- <script charset="utf-8" src="http://zsms.net/Manage/Admin/Public/myeditor/kindeditor-min.js"></script> -->
<!-- <script charset="utf-8" src="http://zsms.net/Manage/Admin/Public/myeditor/lang/zh_CN.js"></script> -->
<?php $i=0;?>
<script>
    KindEditor.ready(function(K) {
        var editor1 = K.create('.editor_id', {
            filterMode: false,//是否开启过滤模式
            cssPath : '/public/static/admin/myeditor/plugins/code/prettify.css',
            uploadJson : '/public/static/admin/myeditor/php/upload_json.php',
            fileManagerJson : '/public/static/admin/myeditor/php/file_manager_json.php',
            allowFileManager : true,
            afterBlur : function() {
                this.sync();
                K.ctrl(document, 13, function() {
                    K('form[name=formlist]')[0].submit();
                });
                K.ctrl(this.edit.doc, 13, function() {
                    K('form[name=formlist]')[0].submit();
                });
            }
        });

        var editor = K.editor({
            allowFileManager : true
        });
    {for start="1" end="config('BANNER_NUM')+1"}
            K('#img{$i}_btn').click(function() {
                editor.loadPlugin('image', function() {
                    editor.plugin.imageDialog({
                        imageUrl : K('#img{$i}').val(),
                        clickFn : function(url, title, width, height, border, align) {
                            K('#img{$i}').val(url);
                            editor.hideDialog();
                        }
                    });
                });
            });
    {/for}

        {if condition="in_array(11,$arr)"}
            K('#insert_file1').click(function() {
                editor.loadPlugin('insertfile', function() {
                    editor.plugin.fileDialog({
                        fileUrl : K('#file1').val(),
                        clickFn : function(url, title) {
                            K('#file1').val(url);
                            editor.hideDialog();
                        }
                    });
                });
            });
    {/if}

        {if condition="in_array(16,$arr)"}
            K('#images').click(function() {
                editor.loadPlugin('multiimage', function() {
                    editor.plugin.multiImageDialog({
                        clickFn : function(urlList) {
                            var div = K('#imagesview');
                            div.html('');
                            var urls = '';
                            K.each(urlList, function(i, data) {
                                div.append('<div style="width: 100px; float:left; padding-right: 10px;"><img src="' + data.url + '" width="100"><br><input type="text" placeholder="输入图片标题"  name="' + data.url + '" class="layui-input"></div>');
                                urls = urls+data.url+'|';
                            });

                            $("#imgurl").val(urls);
                            editor.hideDialog();
                        }
                    });
                });
            });
    {/if}
    });


    $(document).ready(function(){
        $(".delete").click(function(){
            var v=this.title;
            $.get('/Admin-News-Titlepic-id-'+v+".html",null,function(data){
                $(".img"+v).remove();
            });
        })
    });
</script>

<div class="layui-layout layui-layout-admin">
	{include file="public/left" /}
	<div class="layui-body">
		<div class="layui-tab layui-tab-brief" lay-filter="tab">
			<ul class="layui-tab-title">
				<li><a href="{$v.listurl}">{$v.catname}</a></li>
				<li class="layui-this"><a href="{$v.addurl}">{$v.catname}添加</a></li>
			</ul>
			<div class="layui-tab-content">
				<div class="layui-tab-item layui-show">
					<form action="" method="post" name="formlist" class="layui-form" lay-filter="content" id="edit">
						<input type="hidden" name="id" value="{$v.id}">
						
						<div class="layui-form-item">
							<label class="layui-form-label">用户名*</label>
							<div class="layui-input-inline">
								<input type="text" name="username" autocomplete="off" value="{$v.username}" required lay-verify="required" placeholder="请输入用户名" class="layui-input">
							</div>
						</div>

						<div class="layui-form-item">
							<label class="layui-form-label">姓名*</label>
							<div class="layui-input-inline">
								<input type="text" name="name" autocomplete="off" value="{$v.name}" required lay-verify="required" placeholder="请输入用户名" class="layui-input">
							</div>
						</div>

						<div class="layui-form-item">
			              <label class="layui-form-label">密码*</label>
			              <div class="layui-input-inline">
			                <input type="password" name="password" autocomplete="off" value="{$v.password}"  placeholder="请输入密码" class="layui-input">
			              </div>
			            </div>

			            <div class="layui-form-item">
			              <label class="layui-form-label">确认密码*</label>
			              <div class="layui-input-inline">
			                <input type="password" name="repassword" autocomplete="off" value="{$v.password}"  placeholder="请输入确认密码" class="layui-input">
			              </div>
			            </div>

			            <div class="layui-form-item">
			              <label class="layui-form-label">手机号</label>
			              <div class="layui-input-inline">
			                <input type="number" name="tel" autocomplete="off" value="{$v.tel}"  placeholder="请输入手机号" class="layui-input">
			              </div>
			            </div>

			            <div class="layui-form-item">
			              <label class="layui-form-label">邮箱</label>
			              <div class="layui-input-inline">
			                <input type="email" name="email" autocomplete="off" value="{$v.email}"  placeholder="请输入邮箱" class="layui-input">
			              </div>
			            </div>

			            <div class="layui-form-item">
			              <label class="layui-form-label">状态</label>
			              <div class="layui-input-block">
			                <input type="radio" name="status" value="1" title="启用"  {:get_my_checked($v['status'],1)}>
			                <input type="radio" name="status" value="0" title="禁用"  {:get_my_checked($v['status'],0)}>
			              </div>
			            </div>

						{for start="1" end="config('BANNER_NUM')+1"}
							<?php
								$zd="img$i";?>
							<div class="layui-form-item">
								<label class="layui-form-label">配置文件</label>
								<div class="layui-input-inline">
									<input type="text" name="img{$i}" id="img{$i}" value="{$v[$zd]}" placeholder="请上传配置图片"  class="layui-input">
								</div>
								<button type="button" id="img{$i}_btn" class="layui-btn" data-des="ico">
									<i class="layui-icon">&#xe67c;</i>上传图片
								</button>
								{:get_img_show($v[$zd])}
								<font color="red">图片大小:{:get_cfg_var("post_max_size")}内,图片尺寸：{:get_imgsize($i,$v['pid'],$v['ty'],$v['tty'])}px</font>
							</div>
							<?php
								$i++;
							?>
						{/for}


						{if condition="in_array(11,$arr)"}
							<div class="layui-form-item">
								<label class="layui-form-label">文件上传</label>
								<div class="layui-input-inline">
									<input type="text" name="file1" id="file1" value="{$v.file1}" placeholder="请选择文件上传" class="layui-input">
								</div>
								<button type="button" id="insert_file1" class="layui-btn" data-des="enclosure">
									<i class="layui-icon">&#xe67c;</i>上传附件
								</button>

								<font color="#FF0000">文件大小:{:get_cfg_var("post_max_size")}</font>
							</div>
						{/if}

						<div class="layui-form-item">
							<div class="layui-input-block">
								<button class="layui-btn" lay-submit >立即提交</button>
								<button type="reset" class="layui-btn layui-btn-primary">重置</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

	{include file="public/footer" /}
</div>

</body>
</html>
